<?php session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="tab_editor/tabcontent.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.autocomplete.css" />
<script type="text/javascript" src="tab_editor/tabcontent.js"></script>
<script type="text/javascript" src="js/javascript.js"></script>
<script src="ajaxfunction.js" language="javascript" type="text/javascript"></script>
<script language="javascript" type="text/javascript" src="js/calendardateinput.js"></script>
<script src="ckeditor/ckeditor.js" language="javascript"></script>
<script src="js/jquery.js" language="javascript"></script>
<script src="js/jquery.autocomplete.js" language="javascript"></script>
<script language="javascript">
/*	$(document).ready(function() {
	$("#id_tinh").focus().autocomplete();
	
});*/
 $(document).ready(function(){
    //var data = "".split(" ");
$("#id_tinh").autocomplete('showtinhtp.php');
  });
	function change(d)
	{
		if(d.checked==true)
		{
			document.timkiem.doituong.disabled=false;
			document.timkiem.value_check.value=1;
		}
		else
		{
			document.timkiem.doituong.disabled=true;
			document.timkiem.value_check.value=0;
		}
	}
	function ktra_seach()
	{
		if(document.timkiem.tukhoa.value=='Từ khóa')
		{
			alert("Xin vui lòng nhập từ khóa cần tìm!");
			document.timkiem.tukhoa.focus();
			return false;
		}
		else
			return true;
	}
</script>
<title>Quản trị website</title>
</head>

<body background="images/nen_admin.jpg" style="margin:5px auto">
<?php

?>

<table width="960px" border="0px" cellpadding="0px" cellspacing="0" bgcolor="#FFFFFF" align="center" style="margin:25px auto 15px; padding-bottom:20px">
<tr>
<td class="left_admin"></td>
<td style="position:relative;">
<div id="idadmin" >
	<div id="idbanner" align="center" style="text-align:center; color:#FF6600; font-weight:bold; font-size:30px"><br /><br />QUẢN TRỊ WEBSITE
	<div style="text-align:right; margin-top:56px; padding-right:10px; color:#FFFFFF; font-size:12px;"><?php if(isset($_SESSION['admin'])) echo "Xin chào ".$_SESSION['admin']."! (<a href='administrator.php?logout' class='thoat'>Thoát</a>)"; ?></div>
	  <?php //include("giao_dien/banneradmin.php"); ?>
	</div>
	<div id="idadminleft">
	  <?php include("giaodien/adminleft.php");?>
	</div>
	<div id="idadmincenter" align="center">
		<div  style=" width:750px" align="center">
		<div class="divtopleft"></div>
		<div class="divtopcenter"></div>
		<div class="divtopright"></div>
		
		<div class="divright"></div>
		<div class="divleft"></div>
		<div class="divbottomright"></div>
		<div class="divbottomleft"></div>
		<div class="divbottomcenter"></div>
		
    <?php
				if(!isset($_SESSION['admin']))
					echo "<meta http-equiv='refresh' content='0;url=administrator.php' />";
				else
				{
					include("csdl.php");
					$knoi=new csdl();
					$user=$_SESSION['admin'];
					$q=$knoi->queryCsdl("select makh from taikhoan where tendn='$user'");
					if(mysql_num_rows($q)!=1)
						echo "<meta http-equiv='refresh' content='0;url=administrator.php' />";
					else
					{
						include("ckeditor/ckeditor.php");
						//include("functions_php.php");
						$module="home";
					if(isset($_REQUEST['module']))
					{		
							$module=$_REQUEST['module'];
				?>
						<div style="text-align:left; padding-left:30px; padding-right:30px;">
							<form name="timkiem" action="home_admin.php" method="post" onsubmit="return ktra_seach();">
								<input type="hidden" name="module" value="timkiem" />
								<!--<input type="checkbox" name="chon" onclick="change(this)" /> Theo  -->
								<?php
									$arr=array("khachhang"=>"Khách hàng","tinraovat"=>"Tin rao vặt","tintuc"=>"Tin tức","loaitintuc"=>"Loại tin tức");
									$doituong="khachhang";
									$ten="Khách hàng";
									if(isset($_REQUEST['doituong']))
									{
										$doituong=$_REQUEST['doituong'];
										foreach($arr as $key=>$value)
										{
											if($key==$doituong)
												$ten=$value;
										}
									}
								?>
								<select name="doituong">
									<option value="<?php echo $doituong; ?>"><?php echo $ten; ?></option>
									<?php
									foreach($arr as $key=>$value)
									{
										if($key!=$doituong)
										{
									?>
											<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
									<?php
										}
									}
									?>
								</select><input type="hidden" name="value_check" value="0" />
								<input type="text" style="background-image:url(images/search.png); background-repeat:no-repeat; padding-left:27px;" name="tukhoa" value="<?php if(isset($_REQUEST['tukhoa'])) echo $_REQUEST['tukhoa']; else echo "Từ khóa"; ?>" onblur="if(this.value=='') this.value='Từ khóa';" onfocus="if(this.value='Từ khóa') this.value='';" />
								<input type="submit" value="Tìm" src="images/icon_seach.png" class="button" /></form>
							</form>
						</div>
						<br />
				<?php
					}
			?>
						<div style="padding-left:20px; padding-right:20px; margin-left:20px; margin-right:20px;">
			<?php		
						include("admin/".$module.".php");
			?>
						</div>
		<?php
					}
				}
				?>
  </div>
	</div>
</div></td>
<td ></td>
</tr>
</table>
<br />
</body>
</html>
